<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />

<script src="http://cdn.robotwebtools.org/EaselJS/current/easeljs.min.js"></script>
<script src="http://cdn.robotwebtools.org/EventEmitter2/current/eventemitter2.min.js"></script>
<script src="http://cdn.robotwebtools.org/roslibjs/current/roslib.js"></script>
<!-- <script src="http://cdn.robotwebtools.org/ros2djs/current/ros2d.js"></script> -->
<script src="https://rawgit.com/RobotWebTools/ros2djs/develop/build/ros2d.js"></script>
<script src="../build/nav2d.js"></script>

<script>
  /**
   * Setup all visualization elements when the page is loaded.
   */
  function init() {
    // Connect to ROS.
    var ros = new ROSLIB.Ros({
      url : 'ws://localhost:9090'
    });

    // Create the main viewer.
    var viewer = new ROS2D.Viewer({
      divID : 'nav',
      width : 350,
      height : 400
    });

    // Setup the nav client.
    var nav = NAV2D.OccupancyGridClientNav({
      ros : ros,
      rootObject : viewer.scene,
      viewer : viewer,
      serverName : '/pr2_move_base',
      image: 'turtlebot.png'
    });
  }
</script>
</head>

<body onload="init()">
  <h1>Simple Map Example</h1>
  <p>Run the following commands in the terminal then refresh this page.</p>
  <ol>
    <li><tt>roslaunch pr2_gazebo pr2_empty_world.launch</tt>
    </li>
    <li>Place the Willow Garage model over the robot by selecting <tt>Willow Garage</tt> from
      the models list in the <tt>Insert</tt> tab.</li>
    <li><tt>rosrun map_server map_server
        /opt/ros/groovy/stacks/wg_common/willow_maps/willow-sans-whitelab-2010-02-18-0.025.pgm 0.025</tt>
    </li>
    <li><tt>export ROBOT=sim</tt></li>
    <li><tt>roslaunch pr2_2dnav pr2_2dnav.launch</tt></li>
    <li><tt>roslaunch pr2_tuckarm tuck_arms.launch</tt></li>
    <li><tt>rosrun robot_pose_publisher robot_pose_publisher</tt></li>
    <li><tt>roslaunch rosbridge_server rosbridge_websocket.launch</tt>
    </li>
  </ol>
  <div id="nav"></div>
</body>
</html>